//package com.yunhe.option.controller.data;
//
//import com.yunhe.option.domain.data.PushConfig;
//import com.yunhe.common.exception.ObjectNotFoundException;
//import com.yunhe.common.model.ResultObject;
//import com.yunhe.option.service.data.PushConfigService;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiImplicitParam;
//import io.swagger.annotations.ApiImplicitParams;
//import io.swagger.annotations.ApiOperation;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.http.HttpStatus;
//import org.springframework.http.ResponseEntity;
//import org.springframework.web.bind.annotation.*;
//
//import java.util.List;
//import java.util.Optional;
//
//@Api(value = "pushConfig", description = "App推送配置维护", tags = {"Data_PushConfig"})
//@RestController
//@RequestMapping("/pushConfigs")
//public class PushConfigController {
//
//    @Autowired
//    private PushConfigService pushConfigService;
//
//    @ApiOperation("新增App推送配置")
//    @RequestMapping(method = RequestMethod.POST)
//    public ResponseEntity<ResultObject> createPushConfig(
//            @RequestBody PushConfig pushConfig) {
//        PushConfig result = pushConfigService.createPushConfig(pushConfig);
//        return new ResponseEntity<>(new ResultObject<>(result), HttpStatus.OK);
//    }
//
//    @ApiOperation("删除App推送配置")
//    @RequestMapping(value = "/{name}", method = RequestMethod.DELETE)
//    public ResponseEntity<ResultObject> deletePushConfig(
//            @PathVariable("name") String name) {
//        pushConfigService.deletePushConfig(name);
//        return new ResponseEntity<>(new ResultObject<>(null), HttpStatus.OK);
//    }
//
//    @ApiOperation("修改App推送配置")
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "receiveMsg", value = "接收消息和通知", dataType = "int", paramType = "query"),
//            @ApiImplicitParam(name = "voice", value = "声音", dataType = "int", paramType = "query"),
//            @ApiImplicitParam(name = "shock", value = "震动", dataType = "int", paramType = "query"),
//            @ApiImplicitParam(name = "charge", value = "充放电切换", dataType = "int", paramType = "query"),
//            @ApiImplicitParam(name = "alarm", value = "异常告警发生", dataType = "int", paramType = "query"),
//            @ApiImplicitParam(name = "alarmClear", value = "异常告警消除", dataType = "int", paramType = "query")
//    })
//    @RequestMapping(method = RequestMethod.PATCH)
//    public ResponseEntity<ResultObject> updatePushConfig(
//            @RequestParam("name") String name,
//            @RequestParam("receiveMsg") Optional<Integer> receiveMsg,
//            @RequestParam("voice") Optional<Integer> voice,
//            @RequestParam("shock") Optional<Integer> shock,
//            @RequestParam("charge") Optional<Integer> charge,
//            @RequestParam("alarm") Optional<Integer> alarm,
//            @RequestParam("alarmClear") Optional<Integer> alarmClear)
//            throws ObjectNotFoundException {
//        PushConfig result = pushConfigService.updatePushConfig(name, receiveMsg.orElse(null),
//                voice.orElse(null), shock.orElse(null), charge.orElse(null),
//                alarm.orElse(null), alarmClear.orElse(null));
//        return new ResponseEntity<>(new ResultObject<>(result), HttpStatus.OK);
//    }
//
//    @ApiOperation("查询App推送配置")
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "name", value = "账号", required = true, dataType = "string", paramType = "path")
//    })
//    @RequestMapping(value = "/{name}", method = RequestMethod.GET)
//    public ResponseEntity<ResultObject> findPushConfig(
//            @PathVariable("name") String name) {
//        PushConfig result = pushConfigService.findPushConfig(name);
//        return new ResponseEntity<>(new ResultObject<>(result), HttpStatus.OK);
//    }
//
//    @ApiOperation("根据条件查询App推送配置")
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "name", value = "账号", dataType = "string", paramType = "query"),
//            @ApiImplicitParam(name = "alarm", value = "告警产生", dataType = "int", paramType = "query"),
//            @ApiImplicitParam(name = "alarmClear", value = "告警消除", dataType = "int", paramType = "query"),
//            @ApiImplicitParam(name = "charge", value = "充放电", dataType = "int", paramType = "query")
//    })
//    @RequestMapping(method = RequestMethod.GET)
//    public ResponseEntity<ResultObject> findPushConfig(
//            @RequestParam("name") Optional<String> name,
//            @RequestParam("alarm") Optional<Integer> alarm,
//            @RequestParam("alarmClear") Optional<Integer> alarmClear,
//            @RequestParam("charge") Optional<Integer> charge) {
//        List<PushConfig> result = pushConfigService.findPushConfig(name.orElse(null),
//                alarm.orElse(null), alarmClear.orElse(null), charge.orElse(null));
//        return new ResponseEntity<>(new ResultObject<>(result), HttpStatus.OK);
//    }
//}
